package com.wooophone.webapp.mpyeah.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.wooophone.common.web.action.BaseAction;
import com.wooophone.mpyeah.biz.BrandBiz;
import com.wooophone.mpyeah.biz.BrandCategoryBiz;
import com.wooophone.mpyeah.entity.Brand;
import com.wooophone.mpyeah.entity.BrandCategory;

public class IndexAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Autowired
	BrandCategoryBiz brandCategoryBiz;
	public void setBrandCategoryBiz(BrandCategoryBiz brandCategoryBiz) {
		this.brandCategoryBiz = brandCategoryBiz;
	}

	@Autowired
	private BrandBiz brandBiz;
	public void setBrandBiz(BrandBiz brandBiz) {
		this.brandBiz = brandBiz;
	}

	private List<BrandCategory> cates;
	
	private List<Brand> brands;

	public String execute() {
		try {
			cates = brandCategoryBiz.findTopCategory();
			brands = brandBiz.findRecommendBrand(0,pager.getPageSize());
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ERROR;
		}
	}

	public List<BrandCategory> getCates() {
		return cates;
	}

	public List<Brand> getBrands() {
		return brands;
	}

	public void setCates(List<BrandCategory> cates) {
		this.cates = cates;
	}

	public void setBrands(List<Brand> brands) {
		this.brands = brands;
	}
}
